package com.fjec.devops.config;

import com.fjec.common.okhttp.OkHttp;
import com.fjec.common.wx.WxAccessTokenHelper;
import com.fjec.common.wx.WxProperties;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class HttpConfig {
    @Bean
    public OkHttp okHttp() {
        OkHttp okHttp = new OkHttp();
        okHttp.init();
        return okHttp;
    }

    @Bean
    @ConfigurationProperties("wx")
    public WxProperties wxProperties() {
        return new WxProperties();
    }

    @Bean
    public WxAccessTokenHelper wxAccessTokenHelper(OkHttp okHttp,
                                                   WxProperties wxProperties) {
        return new WxAccessTokenHelper(okHttp, wxProperties);
    }
}
